import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)
import { getBanners } from '../request/api.js'
export default new Vuex.Store({
  state: {
    //轮播图图片
    images: []
  },
  mutations: {
    //轮播图图片
    updataImg(state, arr) {
      state.images = arr
    }
  },
  actions: {
    //获取轮播图
    getAdvImg(contxt) {
      getBanners().then(d => {
        console.log(d,77777);
          contxt.commit('updataImg',d.data.list)
      }).catch(e => {
        console.log(e);
      })
    }
  },
  getters: {
    //轮播图图片
    images(state){
      return state.images
    }
  }
})
